package com.view;

import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.ImageCapabilities;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;

public class LoginForm extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private JPanel contentPane;
	private JTextField txtUserName;
	private JPasswordField txtPassword;
	private JLabel lblUserName, lblPassword, lblLogo;
	private JButton btnLogin;

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			System.out.println(e.toString());
		}
		EventQueue.invokeLater(new Runnable() {

			@Override
			public void run() {
				LoginForm loginForm = new LoginForm();
				loginForm.setVisible(true);
				loginForm.setLocationRelativeTo(null);
				;
			}
		});
	}

	public LoginForm() {
		super("Login");
		initComponents();
	}

	public void initComponents() {

		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(null);
		setContentPane(contentPane);

		// add Logo.
		lblLogo = new JLabel();
		lblLogo.setBounds(0, 0, 200, 150);
		lblLogo.setIcon(new ImageIcon("image/login-member.png"));

		lblUserName = new JLabel("Tên Đăng Nhập:");
		lblUserName.setFont(new Font("Courier New", Font.BOLD, 12));
		lblUserName.setForeground(new Color(0, 51, 153));
		lblUserName.setBounds(150, 20, 100, 20);
		txtUserName = new JTextField();
		txtUserName.setBounds(250, 20, 150, 20);
		txtUserName.setFont(new Font("Courier New", Font.BOLD, 12));
		lblPassword = new JLabel("Mật Khẩu:");
		lblPassword.setFont(new Font("Courier New", Font.BOLD, 12));
		lblPassword.setForeground(new Color(0, 51, 153));
		lblPassword.setBounds(150, 55, 100, 20);
		txtPassword = new JPasswordField();
		txtPassword.setBounds(250, 55, 150, 20);
		btnLogin = new JButton("ĐĂNG NHẬP");
		btnLogin.setBounds(250, 85, 150, 35);
		btnLogin.setFont(new Font("Courier New", Font.BOLD, 12));
		btnLogin.setForeground(new Color(0, 51, 153));

		// add components to panel
		contentPane.add(lblLogo);
		contentPane.add(lblUserName);
		contentPane.add(txtUserName);
		contentPane.add(lblPassword);
		contentPane.add(txtPassword);
		contentPane.add(btnLogin);

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(300, 100, 430, 200);
		setResizable(false);
		repaint();

	}

}
